﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Cncard.Web;
using Enter.Common;
using Enter.Web.SystemAdmin;
using Enter.BizLogic;
namespace WebSystemAdmin.sys
{
    public partial class RoleList : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            int totalCount, totalPage, curpage;
            ucPager.PageSize = PageSize;
            Sys_RoleBLLSub bll = new Sys_RoleBLLSub();
            DataTable dataSource = bll.GetTable("", ucPager.PageSize, ucPager.CurrentPageIndex, out totalPage, out totalCount);
            ucPager.RecordCount = totalCount;
            ucPager.CustomInfoText = "合计[" + totalPage + "]页,[" + totalCount + "]条记录";
            rp_Data.DataSource = dataSource;
            rp_Data.DataBind();
        }

        protected void ucPager_PageChanged(object src, PageChangedEventArgs e)
        {
            ucPager.CurrentPageIndex = e.NewPageIndex;
            BindData();
        }
        protected void rp_Data_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                string ID = e.CommandArgument.ToString();
                Sys_OperatorBLLSub bll = new Sys_OperatorBLLSub();
                if (bll.Delete(int.Parse(ID)))
                {
                    Utils.ShowMessage("成功删除");
                    BindData();
                }
            }
        }
    }
}
